package cn.bqjr.eily.web.utils;

import cn.bqjr.eily.web.modules.security.SecuritySessionMgr;
import cn.bqjr.eily.web.modules.security.SecurityUserHandler;
import org.springframework.beans.factory.annotation.Autowired;

import java.io.Serializable;

public class SecurityUtils {

    private static SecuritySessionMgr sessionMgr;

    private static SecurityUserHandler userHandler;

    @Autowired(required = false)
    public void setUserHandler(SecurityUserHandler handler) {
        userHandler = handler;
    }

    @Autowired(required = false)
    public void setSessionMgr(SecuritySessionMgr securitySessionMgr) {
        sessionMgr = securitySessionMgr;
    }

    public static Serializable getLocalUserId() {
        return userHandler.getLocalUserId();
    }

    public static Object getLocalUser() {
        return userHandler.getLocalUser();
    }
}
